﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="Itop.GpsCar.Web.CustomAdmin.home" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <style type="text/css">
#cust{width:252px;height:205px;position:absolute;z-index:10;background:#FFF;display:none;}
</style>
<link rel="stylesheet" type="text/css" href="../resources/css/global.css" />

<link href="../resources/css/account.css" type="text/css" rel="stylesheet">
<link href="../resources/css/suggest.css" type="text/css" rel="stylesheet">
<script src="home_data/x_util.js" type="text/javascript">
<script src="home_data/Ajax.js" type="text/javascript">
<script src="home_data/y_AjaxSuggest.js" type="text/javascript">
<script src="home_data/jquery-1.js" type="text/javascript">
<script type="text/javascript">
var contact = {success:true,data:{name:"上海麦宏工贸有限公司北京科技分公司",phone:"13910852560",addr:"北京市海淀区四道口路11号银辰大厦806",contact:"王向远",loginName:"北京麦宏",company:"上海麦宏工贸有限公司北京科技分公司",state:"0",area:"0",permission:"2",grade:"4",artificial_person:"北京麦宏",office_tel:"13910852560",office_phone:"13910852560",credit_grade:"1061",status:"10001"}};
if(contact == null)
contact = {data:{phone:"13149900613",addr:"深圳市南山区科技园南区长虹科技大厦15楼",contact:"谷米科技",company:"谷米.爱车安"}};
var suggest2;
function MyOnLoad(){
var options = ylib.widget.AjaxSuggest.DefaultOptions();
options.maxSuggestions = 10;
options.useHiddenValue = true;
options.expectValueAndText = true;
options.showNoMatchMessage = false;
options.useTimeout = false;
suggest2 = new ylib.widget.AjaxSuggest('id','customSuggest.jsp?num=10&custId=1189337', options);
document.getElementById("idSuggestBox").className = "txt";
}
var suggestUrl = top.suggestUrl+"&type=1";//suggest查询的接口地址
var treeFrame = top.frames['pageShowFrame_Sales'];
function init(id,layId){
//document.getElementById('sim_id').focus();
var _date = new Date();
dateStr = (_date.getFullYear()+1)+"-"+(_date.getMonth()+1)+"-"+_date.getDate();
document.forms['form1'].out_time.value = dateStr;
var _obj = document.getElementById(id);
var _lay = document.getElementById(layId);
var x = _obj.offsetLeft;
var y = _obj.offsetTop;
var parent = _obj.offsetParent;
while (parent != null){
x += parent.offsetLeft;
y += parent.offsetTop;
parent = parent.offsetParent;
}
//_lay.style.left = x+"px";
//_lay.style.top = (y+20)+"px";
MyOnLoad();
}
function searchProductByImei(imei){
imei = imei.replace(/\s/g,'');
document.getElementById('sim_id').value = imei;
var re = new RegExp(/^[0-9]{5,20}$/);
if (!re.test(imei)){
alert(top.lg.msgcon1);
return;
}
$.ajax({
type : "POST",
url : "searchProductByImei.jsp?school_id=1189337&mds="+top.mds,
data :"&imei="+imei,
success: function(msg){
var m = eval("("+msg+")");
if(m.success){
loadRecord(m.data,"form1",["school_id","sim_id","company","userNames","phone_num","sale_time","remark"])
}else{
alert(top.lg.noImei);
}
}
});
}
function loadRecord(Obj,formId,keyArr){
for(var i=0;i<keyArr.length;i++){
if(eval("document.forms[formId]."+keyArr[i])){
if(keyArr[i] == "remark") Obj[keyArr[i]] = Obj[keyArr[i]].replace(/\<br\/\>/g,"\n");
eval("document.forms[formId]."+keyArr[i]+".value= Obj."+keyArr[i]);
}
}
}
function add(formId){
var sim_id = document.getElementById("sim_id").value;
var userNames = document.getElementById("userNames").value;
var out_time = document.getElementById("out_time").value;
var re = new RegExp(/^[0-9]{1,2}$/);
var re2 = new RegExp(/^[0-9]{15,20}$/);
var re3 = new RegExp("[#,\'\"]");
//var re4 = new RegExp("[`#|{}\\[\\].<>/?~#{}']");
var targetID = document.getElementById('id').value;
if (!re2.test( sim_id)){
alert(top.lg.imeivali);
return;
}
if (userNames == "" || userNames == null){
alert(top.lg.pro+top.lg.name+top.lg.notblank);
return;
}
if(re3.test(userNames)||userNames.indexOf('"')>-1||userNames.indexOf("\\")>-1){
alert(top.lg.pro+top.lg.name+top.lg.notspecial+" #,\',\",\\");
return;
}
if(/[^\d]/.test(formId.phone_num.value)){
alert(top.lg.simCard+top.lg.beNumber);
formId.phone_num.focus();
return;
}
formId.remark.value = formId.remark.value.replace(/\r|\n/g,'<br/>');
if(re3.test(formId.remark.value)||formId.remark.value.indexOf('"')>-1||formId.remark.value.indexOf("\\")>-1){
alert(top.lg.remark+top.lg.notspecial+" #,\',\",\\");
formId.remark.focus();
return ;
}
if(targetID==""){
alert(top.lg.client+top.lg.notblank);
return;
}
var result = confirm(top.lg.saleCheck);
if (!result){
return;
}
var from_id = formId.school_id.value;
var obj =getFormStr(formId);
$.ajax({
type : "POST",
url : "../GetDataService?method=saleProduct&writes=true&login_customer=1189337&id="+targetID,
data :obj,
success: function(msg){
var x = eval("("+msg+")");
var str = "";
if(x.success){
alert(top.lg.saleCallTip[x.type]);
formId.reset();
//document.getElementById('sim_id').focus();
document.getElementById("out_time").value = out_time;
top.reloadTreeRequest("imeis="+sim_id+"&school_ids="+targetID + "," + from_id + "&needSource=1&reloadTree=1&from_id="+from_id+"&to_id="+targetID+"&need_num=1");
}else
alert(top.lg.saleCallTip[x.type]);
}
});
}
function writeDate(id){
if(top.document.getElementById('masklayer'))top.document.getElementById('masklayer').style.display="none";
var Week = top.lg.w;//['日','一','二','三','四','五','六'];
var _date = new Date();
var _y = _date.getFullYear();
var _m = _date.getMonth();
var _w = _date.getDay();
var _d = _date.getDate();
document.getElementById(id).innerHTML = _y +'-' + (_m+1) + '-' + _d +'&nbsp;&nbsp;'+ Week[_w]
}
function wirteCount(obj){
if(obj){
top.login_msg = obj;
document.getElementById('total').innerHTML = obj.total;
document.getElementById('selfNum').innerHTML = obj.selfNum;
document.getElementById('flatNum').innerHTML = obj.flatNum;
document.getElementById('supplyNum').innerHTML = obj.supplyNum;
}
}
var _selectType = "product";
function formType(v)
{
_selectType = v;
top.searchW(v,window)
var cmemu = document.getElementById("custMenuGrup");
var pmenu= document.getElementById("productMenuGrup");
cmemu.className = "menugroup";
pmenu.className = "menugroup";
if(v=="custom"){
cmemu.className = "menugroupover";
suggestUrl = top.suggestUrl+"&type=2";
}else{
pmenu.className = "menugroupover";
suggestUrl = top.suggestUrl+"&type=1";
}
document.getElementById("imeiName").focus();
}
function enterCallback(obj,win){
if(obj.value==""){
return;
}else{
if(_selectType=="custom"){
top.searchCustom('imeiName','title',win);
}else{
top.searchProduct('imeiName','title',win);
}
}
}
function selectCust(id,text){//点击树节点设置销售的客户信息
document.getElementById("id").value = id;
document.getElementById("idSuggestBox").value = text;
//document.getElementById('id').value = id;
//document.getElementById('text').value = text;
document.getElementById('cust').style.display = "none";
treeflag = false;
}
function hiddenSelectTree()
{
if(!isButClick)
{
document.getElementById("cust").style.display = "none";
}
}
window.document.onclick = hiddenSelectTree;
var clickSelectTimer = null;
var isButClick = false;
function clickSelect()
{
isButClick = true;
window.clearTimeout(clickSelectTimer);
clickSelectTimer = setTimeout(function(){
isButClick = false;
},200);
var layer = document.getElementById("cust");
if(layer.style.display == "none")
{
layer.style.display = "block";
}
else
{
layer.style.display = "none";
}
try{
var src = window.frames["treeIframe"].location+"";
if(src.indexOf('null.html')>=0||!treeFrame.reloadTreeFlag.homesale_q){
window.open("custTree.jsp?round=1189337","treeIframe");
treeFrame.reloadTreeFlag.homesale_q = true;
}
}catch(e){}
}
function changePage(i){//页面切换
top.GFRAME.pageMenuShow('Sales','mainTree.jsp?school_id=1189337&infuse='+top.infuse,top.bt[1]);
treeFrame.getselect('treeCustom',i,'treeItemOver',true);
var _i=1;
if(i>0)_i = i+2;
treeFrame.selectSales(_i,treeFrame.salesURL[_i])
}
function changeSaleType(num){//实现批量销售和普通销售的切换
top.batchSaleObj ={imeis:[],text:""};
var el = document.getElementsByName("saleType");
for(var i=0;i<el.length;i++){
if(num == i){
el[i].parentNode.className="current";
//el[i].parentNode.id="currentType";
document.getElementById("saleForm_"+i).style.display ="block";
}else{
el[i].parentNode.className="";
//el[i].parentNode.id='';
document.getElementById("saleForm_"+i).style.display ="none";
}
if(i==1){
var fm = document.getElementById("saleForm_"+i).children[0];
if(fm.getAttribute("src").indexOf('null.html')>-1){
fm.src = "batchSale.jsp?win=false";
}
}
}
}
</script>
<script type="text/javascript" src="../resources/js/home/getFormValue.js"></script>
<script type="text/javascript" src="../resources/js/home/InputFilter.js"></script>
<script type="text/javascript" src="../resources/js/home/WdatePicker.js"></script>
<link href="../resources/css/WdatePicker.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../resources/js/suggest.js"></script>
</head>
<body onload="init('id','cust')">
<div id="main" class="layout open-s233-m">
<div class="col_main">
<div class="main_wrap clearfix">
<div class="col_one">
<div class="mod_box">
<div class="hd">
<h3 class="hd_title">我的工作台</h3>
</div>
<div class="bd img_txt">
<img class="photo" height="101" width="101" src="home_data/photo.jpg">
<ul class="info_list links">
<li>
<h3>flynature</h3>
</li>
<li>
<label>管理员：</label>
flynature&nbsp;
<a href="javascript:top.win.openWinLayer(top.lg.updatepwd,'../changePassword.jsp?school_id=1189337',400,200,2,window,null);">[修改密码]</a>
</li>
<li>
<label>过期设备：</label>
<a href="javascript:changePage(1);">
缴费(
<span id="flatNum">0</span>
)
</a>
，
<a href="javascript:changePage(2);">
收费(
<span id="supplyNum">0</span>
)
</a>
</li>
<li>
<label>设备数量：</label>
<a href="javascript:top.GFRAME.pageMenuShow('Sales','mainTree.jsp?school_id=1189337',top.bt[1]);">
进货(
<span id="total">0</span>
)，库存(
<span id="selfNum">0</span>
)
</a>
</li>
</ul>
</div>
</div>
<div class="quick_ops clearfix">
<h3 class="title">更多操作</h3>
<ul class="operations links">
<li>
<a title="需要向下级收费的客户及设备信息" href="javascript:changePage(2)">收费客户</a>
</li>
<li>|</li>
<li>
<a title="需要向上级缴费的客户及设备信息" href="javascript:changePage(1)">缴费客户</a>
</li>
<li>|</li>
<li>
<a href="javascript:changePage(0)">设备</a>
</li>
<li>|</li>
<li>
<a href="http://bendi.gpsoo.net/cs/guid.htm" target="_blank">操作指南</a>
</li>
</ul>
</div>
<div class="mod_box">
<div class="hd">
<h3 class="hd_title">我的服务商</h3>
</div>
<div class="bd img_txt">
<img class="photo" height="101" width="101" src="home_data/photo.jpg">
<ul class="info_list links">
<li>
<label>
<script type="text/javascript">
    document.write(top.lg.ServerProvider);
</script>
服务商服务商：
</label>
<script type="text/javascript">
    document.write(contact.data.name);
</script>
上海麦宏工贸有限公司北京科技分公司上海麦宏工贸有限公司北京科技分公司
</li>
<li>
<label>
<script type="text/javascript">
    document.write(top.lg.contact);
</script>
联系人联系人：
</label>
<script type="text/javascript">
    document.write(contact.data.contact);
</script>
王向远王向远
</li>
<li>
<label>
<script type="text/javascript">
    document.write(top.lg.phone);
</script>
电&#12288;话电&#12288;话：
</label>
<script type="text/javascript">
    document.write(contact.data.phone);
</script>
1391085256013910852560
</li>
<li>
<label>
<script type="text/javascript">
    document.write(top.lg.address);
</script>
地&#12288;址地&#12288;址：
</label>
<script type="text/javascript">
    document.write(contact.data.addr);
</script>
北京市海淀区四道口路11号银辰大厦806北京市海淀区四道口路11号银辰大厦806
</li>
</ul>
</div>
</div>
</div>
<div class="col_two">
<div class="mod_box">
<div class="hd">
<ul class="tab_ctrl">
<li class="current">
<a href="javascript:changeSaleType(0);" name="saleType" hidefocus="">快速销售</a>
</li>
<li>
<a href="javascript:changeSaleType(1);" name="saleType" hidefocus="">批量销售</a>
</li>
</ul>
</div>
<div class="bd">
<ul class="cartons">
<li id="saleForm_0" class="ctn current">
<table class="sale_a">
<tbody>
<tr class="sale_to">
<th>
<span class="required">*</span>
销售给
</th>
<td colspan="2">
<input id="idSuggestBox" class="txt" value="flynature">
<div id="cust" style="display: none;">
<iframe id="treeIframe" frameborder="0" scrolling="no" name="treeIframe" style="width: 100%; height: 100%;" src="home_data/null.htm">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body>
<div style="padding:20px; font-size:13px; color:#0066CC">LOADING...</div>
</body>
</html>
</iframe>
</div>
<input id="id" class="txt" type="text" name="id" style="display: none;" value="1189337">
<span id="id_sugg" class="suggestions" style="z-index: 101; position: absolute; left: 970px; top: 79px; display: none; width: 232px;"></span>
</td>
<td>
<a class="btn_drop" href="###" onclick="clickSelect();"></a>
</td>
<td class="links">
<a href="###" onclick="top.win.openWinLayer(top.lg.addutit,'newCustom.jsp?p_id=1189337&homeCallBack=selectCust&name=null',550,400,2,window,null);">新增客户</a>
</td>
</tr>
<form id="form1" action="" method="post" name="form1"></form>
<input type="hidden" name="school_id">
<tr>
<th>
<span class="required">*</span>
设备号(IMEI)
</th>
<td>
<input id="sim_id" class="txt" type="text" maxlength="15" onfocus="this.select();" onkeydown="if(event.keyCode==13) searchProductByImei(document.getElementById('sim_id').value);" name="sim_id">
</td>
<td>
<a class="btn_x" allow="false" name="Submit5" onclick="searchProductByImei(document.getElementById('sim_id').value)" href="###">
搜索
<b class="bg_l"></b>
<b class="bg_r"></b>
</a>
</td>
</tr>
<tr>
<th>
<span class="required">*</span>
设备名
</th>
<td>
<input id="userNames" class="txt" type="text" maxlength="20" name="userNames">
</td>
</tr>
<tr>
<th>设备属于</th>
<td colspan="4">
<input id="company" class="ipt" type="text" onfocus="this.blur();" readonly="readonly" style="width: 300px; border: medium none;" name="company">
</td>
</tr>
<tr>
<th>设备电话(SIM卡号)</th>
<td>
</tr>
<tr>
<th>用户到期</th>
<td>
<input id="out_time" class="txt input_calendar" type="text" onclick="WdatePicker({dateFmt:'yyyy-M-d'})" readonly="readonly" name="out_time" value="2013-7-28">
</td>
</tr>
<tr class="remark">
<th>备注 </th>
<td colspan="2">
<textarea id="remark" maxlength="200" name="remark"></textarea>
</td>
</tr>
<tr class="submit">
<th></th>
<td>
<a class="btn_x" href="###" onclick="add(document.forms['form1'])">
销售
<b class="bg_l"></b>
<b class="bg_r"></b>
</a>
<input class="btn btn_reset" type="reset" allow="false" value="重置">
</td>
</tr>
</tbody>
</table>
</li>
<li id="saleForm_1" class="ctn">
<iframe frameborder="0" scrolling="no" style="width: 100%; height: 290px;" src="home_data/null.htm">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body>
<div style="padding:20px; font-size:13px; color:#0066CC">LOADING...</div>
</body>
</html>
</iframe>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col_sub">
<div class="mod_nav">
<div class="hd">
<h3>我的账户</h3>
</div>
<div class="bd">
<ul>
<li class="first on">
<a href="javascript:top.GFRAME.pageMenuShow('Home','home.jsp?school_id=1189337&hiddenTop=true',top.bt[0]);">账户首页</a>
</li>
<li class="last ">
<a href="javascript:top.GFRAME.pageMenuShow('Message','viewMessage.jsp?school_id=1189337',top.bt[0]);">消息中心</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div style="display:none; clear:left; padding-top:35px; padding-left:20px; padding-bottom:20px;margin-bottom:15px;">
<div>
<div id="productMenuGrup" class="menugroupover" onclick="formType('product')">
<a hidefocus="" style="outline: medium none;" href="javascript:;">设备</a>
</div>
<div id="custMenuGrup" class="menugroup" onclick="formType('custom')">
<a hidefocus="" style="outline: medium none;" href="javascript:;">客户</a>
</div>
</div>
<div style="clear:left;">
<div style="width:226px; float:left; height:24px;">
<form id="f" onsubmit="return false;" action="#" name="f">
<input id="imeiName" type="text" onkeydown="if(event.keyCode==13) enterCallback(this,window);" title="设备名/车号/设备号(IMEI)后5位" onblur="top.setDefault(this,'title')" onfocus="top.clearDefault(this,'title')" value="设备名/车号/设备号(IMEI)后5位" name="imeiName" autocomplete="off">
<div id="sd_1343449632614" style="display: none;"></div>
</form>
</div>
<div style="height:24px; float:left;background:url(images/ihome_10.jpg) no-repeat;width:93px;">
<div id="product" style="cursor:pointer;width:93px;height:24px;line-height:24px;font-size:14px;color:#FFF;font-weight:bold;text-align:center;" onclick="top.searchProduct('imeiName','title',window)">搜索</div>
<div id="custom" style="cursor:pointer;width:93px;height:24px;line-height:24px;font-size:14px;color:#FFF;font-weight:bold;text-align:center;display:none;" onclick="top.searchCustom('imeiName','title',window)">搜索</div>
</div>
<div id="adv" style="height:24px;line-height:24px;">
<a style="margin-left: 10px;" href="javascript:top.searchProductHeight();">高级搜索</a>
</div>
<div style="clear:both;">
<img height="1" width="1" src="flynature_files/null.gif">
</div>
</div>
</div>
<script type="text/javascript">
    //加载JS
    function loadFile(arr) {//需要加载的JS数组
        var oHead = document.getElementsByTagName('HEAD').item(0);
        for (var i = 0; i < arr.length; i++) {
            var oScript = document.createElement("script");
            oScript.type = "text/javascript";
            oScript.src = arr[i];
            oHead.appendChild(oScript);
        }
    }
    var JS_ARRAY = ["../js/getFormValue.js", "../js/InputFilter.js", "../My97DatePicker/WdatePicker.js", "../js/suggest.js"];
    setTimeout(function() { loadFile(JS_ARRAY); }, 3000);
</script>
   
</body>
</html>
